package com.neutech.controller;

import com.neutech.service.ResultService;
import com.neutech.service.DepartmentService;
import com.neutech.service.DoctorService;
import com.neutech.service.SchedulService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@CrossOrigin
@RestController
public class ResultController {
//    @Autowired
//    private MenuService menuService;
    /*******************医生___START*************************/
    @Autowired
    private ResultService resultService;
    @RequestMapping("/queryResult")
    public List<Map<String,Object>> getResult(){
        return resultService.queryResult();
    }
    @RequestMapping("/insertResult")
    public void insResult(@RequestParam Map  map){
        resultService.insertResult(map);
        System.out.println(map.get("resultid"));
    }
    @RequestMapping("/deleteResult")
    public void delResult(@RequestParam Map  map){
        resultService.deleteResult(map);
        System.out.println(map.get("resultid"));
    }
    @RequestMapping("/updataResult")
    public void updResult(@RequestParam Map  map){
//        System.out.println("看这里");
//        System.out.println(map);
//        System.out.println("看这里");
        Map<String,Object> map2 = new HashMap<>();
        map2.put("resultid",map.get("resultid"));
        map2.put("name",map.get("name"));
        map2.put("patid",map.get("patid"));
        map2.put("old",map.get("old"));
        map2.put("sex",map.get("sex"));
        map2.put("tid",map.get("tid"));
        map2.put("checkresult",map.get("checkresult"));
        map2.put("docid",map.get("docid"));
        map2.put("finalresult",map.get("finalresult"));
        map2.put("prescription",map.get("prescription"));
        map2.put("suggestion",map.get("suggestion"));
        resultService.updataResult(map2);
    }
    /**************************END*******************************/

}
